package com.yxq.mdt.app.modules.auction.adapter;

import android.graphics.Color;
import android.text.TextUtils;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.yxq.mdt.app.R;
import com.yxq.mdt.app.modules.auction.bean.AuctionProfitBean;

import java.util.List;

public class AuctionProfitListAdapter extends BaseQuickAdapter<AuctionProfitBean.PmUserCashDrillPageListBean.ListBean, BaseViewHolder> {


    public AuctionProfitListAdapter(int layoutResId, @Nullable List<AuctionProfitBean.PmUserCashDrillPageListBean.ListBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AuctionProfitBean.PmUserCashDrillPageListBean.ListBean item) {
        helper.setText(R.id.item_auction_money, "￥" + item.getActualAmount());
        helper.setText(R.id.item_auction_name, "提现");
        if (item.getCreateTime() != null) {
            helper.setText(R.id.item_auction_time, item.getCreateTime());
        } else {
            helper.setText(R.id.item_auction_time, "");
        }
        if (!TextUtils.isEmpty(item.getStateDesc())) {
            helper.setText(R.id.item_auction_type, item.getStateDesc());
        } else {
            switch (item.getState()) {
                case 0:
                    helper.setText(R.id.item_auction_type, "审核中");
                    helper.setTextColor(R.id.item_auction_type, Color.parseColor("#c0c0c0"));
                    break;
                case 1:
                    helper.setText(R.id.item_auction_type, "审核通过,即将打款");
                    helper.setTextColor(R.id.item_auction_type, Color.parseColor("#ffff4444"));
                    break;
                case 2:
                    helper.setText(R.id.item_auction_type, "已完成");
                    helper.setTextColor(R.id.item_auction_type, Color.parseColor("#6FCD78"));
                    break;
                case 3:
                    helper.setText(R.id.item_auction_type, "已到账");
                    helper.setTextColor(R.id.item_auction_type, Color.parseColor("#FF17A000"));
                    break;
                case 4:
                    helper.setText(R.id.item_auction_type, "审核不通过，提现金额已退还");
                    helper.setTextColor(R.id.item_auction_type, Color.parseColor("#c0c0c0"));
                    break;
                default:
            }
        }

    }
}
